package com.azh.springcloud.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

@Configuration
//applicationcontext.xml 的<bean ......>
public class ApplicationContextConfig {
    @Bean
    @LoadBalanced //负载均衡，可以通过输入微服务名称来调用业务，会随机分配给某个server
    public RestTemplate getRestTemplate(){
        return new RestTemplate();
    }
}
